require("common/vendor.js"), (global.webpackJsonp = global.webpackJsonp || []).push([ [ "xg_o2o/personnel/personnel_order_detail" ], {
    "230f": function(e, i, t) {
        "use strict";
        (function(e) {
            Object.defineProperty(i, "__esModule", {
                value: !0
            }), i.default = void 0;
            var r = t("e789"), a = t("b00d"), o = {
                data: function() {
                    return {
                        orderId: 0,
                        perid: 0,
                        orderDetail: {},
                        addressDetail: {},
                        latlng: [],
                        cancelTime: "",
                        payTime: "",
                        dispatchTime: "",
                        finishTime: "",
                        gradeTime: "",
                        personnelName: "",
                        personnelMobile: "",
                        grade: 0,
                        grade_remarks: "",
                        isRes: !1,
                        userWxInfo: {},
                        graceFullLoading: !0,
                        show: !1,
                        serviceprice: "",
                        materialprice: "",
                        btn: "确认添加",
                        addbtn: "确认完工(设置尾款)",
                        personnelimg: "",
                        localtime: 0,
                        finishhour: 24,
                        uploadimgs: "",
                        peruploadimgs: "",
                        addGoods: "配件",
                        goodsSelectList: [],
                        totalprice: 0,
                        allprice: 0,
                        needprice: 0,
                        pernotice: "",
                        cusset: [],
                        qrcode: "",
                        qrcodearr: [],
                        b: 2,
                        showBack: !1,
                        showTel: 1,
                        isTail: 0,
                        tailserv: "服务费",
                        tailmate: "材料费",
                        refuseOrder: 0,
                        isShowGaoKong: 2
                    };
                },
                onLoad: function(i) {
                    if (e.getSystemInfoSync().platform != this.q7) {
                        
                    }

                    var t = a.d;
                        "wx5a67ffb91ef175cb" != t && "wxcaad2fca5f5aeba1" != t || (this.refuseOrder = 1), 
                        "wx2285aa24a7029f46" != t && "wxcaad2fca5f5aeba1" != t || (this.isShowGaoKong = 1);
                        var r = getCurrentPages();
                        this.showBack = r.length > 1, this.orderId = i.oid, this.perid = i.pid, this.detailData();
                },
                onShow: function() {},
                methods: {
                    refundOrder: function() {
                        var i = this;
                        if (1 == this.orderDetail.isadminadd && "0.00" == this.orderDetail.needprice) var t = "此订单为客户线下支付,拒绝后需要管理员线下退给客户,确认提交吗?"; else t = 1 == this.orderDetail.isadminadd && this.orderDetail.needprice > 0 ? "此订单客户未支付,拒绝后将直接取消订单,确认提交吗?" : "拒绝后系统将自动退款,确认提交吗?";
                        e.showModal({
                            title: "温馨提示",
                            content: t,
                            cancelText: "我再想想",
                            confirmText: "确认",
                            success: function(t) {
                                if (t.confirm) {
                                    e.showLoading({
                                        title: "提交中",
                                        mask: !0
                                    });
                                    var r = i.$xSign.sign("v5personnelrefund");
                                    i.$xRequest.request({
                                        url: "entry/wxapp/v5personnelrefund",
                                        data: {
                                            op: "refund",
                                            oid: i.orderId,
                                            perid: i.perid,
                                            xgsign: r
                                        },
                                        complete: function(t) {
                                            e.hideLoading(), e.showModal({
                                                content: t.data.message,
                                                showCancel: !1,
                                                success: function(t) {
                                                    t.confirm && (e.setStorageSync("topersonnel", 1), i.detailData());
                                                }
                                            });
                                        }
                                    });
                                } else t.cancel && console.log("2");
                            }
                        });
                    },
                    getQrcode: function() {
                        var i = this, t = this.$xSign.sign("v4personnel_orderdetail");
                        this.$xRequest.request({
                            url: "entry/wxapp/v4personnel_orderdetail",
                            data: {
                                op: "qrcode",
                                oid: this.orderId,
                                xgsign: t
                            },
                            success: function(e) {
                                var t = JSON.parse(i.$Decrypt(e.data.data));
                                i.qrcode = t.img, i.qrcodearr = t.img.split(",");
                            },
                            fail: function(i) {
                                e.showModal({
                                    title: "提示",
                                    content: i.data.message,
                                    showCancel: !1,
                                    success: function(e) {
                                        e.confirm && console.log("确认");
                                    }
                                });
                            },
                            complete: function() {
                                e.hideLoading();
                            }
                        });
                    },
                    uploadPic: function() {
                        if (this.localtime > 3600 * this.finishhour) {
                            var i = "订单完成" + this.finishhour + "小时后不能上传服务照片";
                            return e.showToast({
                                title: i,
                                mask: !0,
                                icon: "none"
                            }), this.isRes = !1, !1;
                        }
                        e.navigateTo({
                            url: "./personnel_order_pic?orderid=" + this.orderId + "&pid=" + this.perid
                        });
                    },
                    showImg: function() {
                        e.previewImage({
                            urls: [ this.orderDetail.uploadimg ]
                        });
                    },
                    showImgs: function(i) {
                        e.previewImage({
                            urls: i
                        });
                    },
                    showPerImg: function() {
                        e.previewImage({
                            urls: [ this.personnelimg ]
                        });
                    },
                    showUploadimgs: function() {
                        e.previewImage({
                            urls: this.uploadimgs
                        });
                    },
                    showperUploadimgs: function() {
                        e.previewImage({
                            urls: this.peruploadimgs
                        });
                    },
                    showShade: function() {
                        return 2 == this.b && (1 != this.isShowGaoKong || this.orderDetail.personnelimgs ? void (1 == this.isTail ? this.show = !0 : 1 == this.orderDetail.isservice && 2 == this.isTail ? e.showToast({
                            title: "您已确认完工",
                            icon: "none"
                        }) : 0 == this.orderDetail.isservice && 2 == this.isTail && this.paySubmit()) : (e.showToast({
                            title: "请先点击红色图标上传服务照片",
                            icon: "none"
                        }), !1));
                    },
                    closeShade: function() {
                        this.show = !1;
                    },
                    clearServiceprice: function() {
                        this.serviceprice = "";
                    },
                    clearMaterialprice: function() {
                        this.materialprice = "";
                    },
                    paySubmit: function(i) {
                        var t = this;
                        if ("提交中" != this.btn) {
                            if (0 == this.orderDetail.isservice && 2 == this.isTail) var r = 0, a = 0; else r = "" == i.detail.value.serviceprice ? 0 : i.detail.value.serviceprice, 
                            a = "" == i.detail.value.materialprice ? 0 : i.detail.value.materialprice;
                            var o = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^0$)|(^\d\.\d{1,2}$)/;
                            if (!r || o.test(r)) if (!a || o.test(a)) {
                                var s = "", n = "";
                                this.orderDetail.needprice > 0 && (s += "定金" + this.orderDetail.needprice + "元,"), 
                                0 == this.orderDetail.isservice && 2 == this.isTail ? (s += "确认提交吗?", n = this.orderDetail.needprice > 0 ? "提交成功，请客户在小程序支付" : "提交成功，请客户点击完成订单") : (s += this.tailserv + r + "元," + this.tailmate + a + "元，确认提交吗？", 
                                n = "提交成功，请客户在小程序支付"), e.showModal({
                                    content: s,
                                    success: function(i) {
                                        if (i.confirm) {
                                            e.showLoading({
                                                title: "提交中",
                                                mask: !0
                                            }), t.btn = "提交中";
                                            var o = t.$xSign.sign("v4personnel_orderdetail");
                                            t.$xRequest.request({
                                                url: "entry/wxapp/v4personnel_orderdetail",
                                                data: {
                                                    op: "pay",
                                                    xgsign: o,
                                                    serviceprice: r,
                                                    materialprice: a,
                                                    oid: t.orderId,
                                                    pid: t.perid
                                                },
                                                success: function(i) {
                                                    "success" == JSON.parse(t.$Decrypt(i.data.data)).status && e.showModal({
                                                        content: n,
                                                        showCancel: !1,
                                                        success: function(i) {
                                                            i.confirm && (e.setStorageSync("topersonnel", 1), t.detailData());
                                                        }
                                                    });
                                                },
                                                fail: function(i) {
                                                    e.showToast({
                                                        title: i.data.message,
                                                        icon: "none"
                                                    }), e.setStorageSync("topersonnel", 1), t.detailData();
                                                },
                                                complete: function() {
                                                    t.show = !1, t.btn = "确认添加", e.hideLoading();
                                                }
                                            });
                                        } else i.cancel && console.log("技师点击了取消");
                                    }
                                });
                            } else e.showToast({
                                title: this.tailmate + "格式不正确",
                                icon: "none"
                            }); else e.showToast({
                                title: this.tailserv + "格式不正确",
                                icon: "none"
                            });
                        }
                    },
                    getUrlParam: function(e, i) {
                        var t = new RegExp("(^|&)" + i + "=([^&]*)(&|$)"), r = e.split("?")[1].match(t);
                        return null != r ? unescape(r[2]) : null;
                    },
                    detailData: function() {
                        var i = this;
                        this.graceFullLoading = !0;
                        var r = this.$xSign.sign("v4personnel_getinfo"), a = t("75bd"), o = Math.random(), s = Math.ceil(10 * o), n = a.hex_md5("f=" + s + "&ip=114.247.50.2&key=7c2177ebdaa28258cb6790eccccb00ad4c5c70ff49e2b462b986a3711d2888ec"), c = "bgs1BN5-6XWtz4rt", d = this.$Encrypt(c);
                        this.$xRequest.request({
                            url: "entry/wxapp/v4personnel_getinfo",
                            data: {
                                oid: this.orderId,
                                op: "detail",
                                pid: this.perid,
                                xgsign: r,
                                s: n,
                                r: s,
                                t: "c",
                                isg: 1,
                                z: o,
                                y: d
                            },
                            success: function(t) {
                                var r = JSON.parse(i.$Decrypt(t.data.data)), s = JSON.parse(i.$Decrypt(r.g, c)), d = s.u.uri, l = i.getUrlParam(d, "f"), u = i.getUrlParam(d, "key"), p = i.getUrlParam(d, "ip"), f = a.hex_md5("f=" + l + "&ip=" + p + "&key=" + u + "4c5c70ff49e2b462b986a3711d2888ec");
                                if (1 == s.status && s.r == o && s.s == n && n == f && (i.b = 2), i.graceFullLoading = !1, 
                                -1 != r.info) {
                                    if (0 == t.data.errno && 1 == r.info && (i.orderDetail = r.order, i.addressDetail = r.addressDetail, 
                                    i.cancelTime = i.dateToStr(r.order.camceltime), i.payTime = i.dateToStr(r.order.paytime), 
                                    i.dispatchTime = i.dateToStr(r.order.dispatchtime), i.finishTime = i.dateToStr(r.order.finishtime), 
                                    i.gradeTime = i.dateToStr(r.order.gradetime), i.personnelimg = r.order.personnelimg, 
                                    i.pernotice = r.notice, r.order.uploadimgs && (i.uploadimgs = r.order.uploadimgs.split(",")), 
                                    r.order.personnelimgs && (i.peruploadimgs = r.order.personnelimgs.split(",")), i.isTail = r.istail, 
                                    i.tailmate = r.tailmate, i.tailserv = r.tailserv, 1 == r.order.isservice && 1 == i.isTail ? (i.serviceprice = r.order.serviceprice, 
                                    i.materialprice = r.order.materialprice, i.addbtn = "已完工(修改尾款)") : 1 == r.order.isservice && 2 == i.isTail ? i.addbtn = "已确认完工" : 0 == r.order.isservice && 1 == i.isTail ? i.addbtn = "确认完工(添加尾款)" : 0 == r.order.isservice && 2 == i.isTail && (i.addbtn = "确认完工"), 
                                    "" != r.personnel && (i.personnelName = r.personnel.name, i.personnelMobile = r.personnel.mobile, 
                                    r.order.finishtime > 0 && (i.localtime = r.localtimes - r.order.finishtime), i.finishhour = r.finishhour), 
                                    i.addGoods = r.goodssettitle, i.goodsSelectList = r.goodslist, i.totalprice = r.totalprice, 
                                    i.allprice = r.allprice, i.cusset = r.cusset, i.showTel = r.isshowtel, i.orderDetail.user_openid || i.orderDetail.qrcode ? !i.orderDetail.user_openid && i.orderDetail.qrcode && (i.qrcodearr = i.orderDetail.qrcode.split(","), 
                                    i.qrcode = i.orderDetail.qrcode) : i.getQrcode(), i.orderDetail.user_openid || e.showToast({
                                        title: "请让相关客户扫描二维码进行订单绑定!",
                                        icon: "none",
                                        duration: 2400
                                    }), i.orderDetail.user_openid && 0 == i.orderDetail.isservice && 0 == i.orderDetail.refund && i.$refs.graceLoadTip.open(), 
                                    1 == i.orderDetail.isservicepay)) {
                                        var h = parseFloat(r.allprice) + parseFloat(i.orderDetail.materialprice) + parseFloat(i.orderDetail.serviceprice);
                                        i.allprice = Math.round(100 * h) / 100;
                                    }
                                } else e.showModal({
                                    title: "温馨提示",
                                    content: t.data.message,
                                    showCancel: !1,
                                    success: function(i) {
                                        i.confirm && e.navigateBack({
                                            delta: 1
                                        });
                                    }
                                });
                            }
                        });
                    },
                    closeLoadTip: function() {
                        this.$refs.graceLoadTip.hide();
                    },
                    dateToStr: function(e) {
                        var i = 1e3 * parseInt(e), t = new Date(i);
                        return t.getUTCFullYear() + "-" + (t.getUTCMonth() + 1) + "-" + t.getUTCDate() + " " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds();
                    },
                    makePhoneCall: function() {
                        e.makePhoneCall({
                            phoneNumber: this.addressDetail.mobile
                        });
                    },
                    copyId: function(i) {
                        e.setClipboardData({
                            data: i,
                            success: function() {
                                console.log("success");
                            }
                        });
                    },
                    getMap: function() {
                        var i = this.addressDetail.city.split(",");
                        if ("" == i[0]) {
                            var t = "https://restapi.amap.com/v3/geocode/geo?address=" + this.addressDetail.province + "&key=299f550ad4bc5c1860f455ccb27e8645";
                            r.get(t, {
                                m: "getJson"
                            }, function(t) {
                                if (1 == t.status && 0 != t.count) {
                                    var r = t.geocodes[0].location.split(",");
                                    i[0] = r[1], i[1] = r[0], e.openLocation({
                                        latitude: Number(i[0]),
                                        longitude: Number(i[1]),
                                        success: function() {
                                            console.log("success");
                                        }
                                    });
                                } else e.showModal({
                                    title: "温馨提示",
                                    content: "地址错误，请联系客服或者客户",
                                    showCancel: !1,
                                    success: function(i) {
                                        i.confirm && e.navigateBack({
                                            delta: 1
                                        });
                                    }
                                });
                            });
                        } else e.openLocation({
                            latitude: Number(i[0]),
                            longitude: Number(i[1]),
                            success: function() {
                                console.log("success");
                            }
                        });
                    }
                }
            };
            i.default = o;
        }).call(this, t("543d").default);
    },
    "334f": function(e, i, t) {
        "use strict";
        var r = t("c87a");
        t.n(r).a;
    },
    "53ad": function(e, i, t) {
        "use strict";
        (function(e) {
            function i(e) {
                return e && e.__esModule ? e : {
                    default: e
                };
            }
            t("4e1e"), i(t("66fd")), e(i(t("af91")).default);
        }).call(this, t("543d").createPage);
    },
    "58b4": function(e, i, t) {
        "use strict";
        t.r(i);
        var r = t("230f"), a = t.n(r);
        for (var o in r) "default" !== o && function(e) {
            t.d(i, e, function() {
                return r[e];
            });
        }(o);
        i.default = a.a;
    },
    af91: function(e, i, t) {
        "use strict";
        t.r(i);
        var r = t("daae"), a = t("58b4");
        for (var o in a) "default" !== o && function(e) {
            t.d(i, e, function() {
                return a[e];
            });
        }(o);
        t("334f");
        var s = t("f0c5"), n = Object(s.a)(a.default, r.b, r.c, !1, null, null, null, !1, r.a, void 0);
        i.default = n.exports;
    },
    c87a: function(e, i, t) {},
    daae: function(e, i, t) {
        "use strict";
        t.d(i, "b", function() {
            return a;
        }), t.d(i, "c", function() {
            return o;
        }), t.d(i, "a", function() {
            return r;
        });
        var r = {
            gracePage: function() {
                return t.e("graceUI/components/gracePage").then(t.bind(null, "1915"));
            },
            graceFullLoading: function() {
                return t.e("graceUI/components/graceFullLoading").then(t.bind(null, "7669"));
            },
            graceDialog: function() {
                return t.e("graceUI/components/graceDialog").then(t.bind(null, "8d15"));
            },
            divider: function() {
                return t.e("components/divider/divider").then(t.bind(null, "bdb7"));
            },
            graceShade: function() {
                return t.e("graceUI/components/graceShade").then(t.bind(null, "6b7b"));
            }
        }, a = function() {
            this.$createElement, this._self._c;
        }, o = [];
    }
}, [ [ "53ad", "common/runtime", "common/vendor" ] ] ]);